package cn.changeforyou.web.plugin.page;

import static cn.changeforyou.web.plugin.page.LocalThreadPageUtil.PAGE_NUMBER;
import static cn.changeforyou.web.plugin.page.LocalThreadPageUtil.PAGE_SIZE;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @md-api
 * mybatis-plus的工具类
 * @author zhyu
 * @date 2021/2/26 11:58
 */
public class MybatisPlusPageUtil {

    /**
     * 根据service的类型信息, 获取指定泛型的page对象
     * @param <A>
     * @param <T>
     * @param clazz
     * @return
     */
    public static <A extends BaseMapper<T>, T> Page<T> getPageInfo(Class<? extends ServiceImpl<A, T>> clazz){
        return new Page<T>(PAGE_NUMBER.get(), PAGE_SIZE.get());
    }
}
